{% extends "store/blank.html" %}

{% block title %}
    天天生鲜
{% endblock %}

{% block label %}
    商品添加
{% endblock %}

{% block content %}
    <div class="row">
                <button class="btn btn-primary col-lg-2 ml-auto" data-toggle="modal" data-target="#goods_modal">添加商品</button>
          </div>
    <h1></h1>
    <!--商品列表-->
    <div class="row">
      <table class="table">
          <thead>
            <tr>
                <th>商品编号</th>
                <th>商品名称</th>
                <th>商品类型</th>
                <th>商品价格</th>
                <th>商品数量</th>
            </tr>
          </thead>
          <tbody>
            {% for g in goods_list %}
            <tr>
                <td>{{ g.goods_id }}</td>
                <td>
                    <a href="#">{{ g.goods_name }}</a>
                </td>
                <td>{{ g.g_type.t_name }}</td>
                <td>{{ g.goods_price }}</td>
                <td>{{ g.goods_number }}</td>
            </tr>
            {% endfor %}
          </tbody>
      </table>
  </div>
    <h1></h1>
    <!--分页-->
    <div class="row">
                <ul class="pagination ml-auto">
                    <li class="page-item">
                        <a class="page-link">上一页</a>
                    </li>
                    <li class="page-item">
                        <a class="page-link">1</a>
                    </li>
                    <li class="page-item">
                        <a class="page-link">2</a>
                    </li>
                                        <li class="page-item">
                        <a class="page-link">3</a>
                    </li>
                    <li class="page-item">
                        <a class="page-link">4</a>
                    </li>
                    <li class="page-item">
                        <a class="page-link">下一页</a>
                    </li>
                </ul>
          </div>
    <!--商品添加-->
    <div class="modal fade" id="goods_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-label="true">
      <div class="modal-dialog" role="document">
          <div class="modal-content">
              <div class="modal-header">添加商品</div>
              <div class="modal-body">
                  <form class="form" method="post" enctype="multipart/form-data" action="/store/goods/">
                    {% csrf_token %}
                      <div class="form-group">
                        <label class="">商品名称</label>
                        <input class="form-control" type="text" name="goods_name">
                      </div>
                      <div class="form-group">
                        <label class="">商品类型</label>
                        <select class="form-control" name="goods_type">
                            <option>--商品类型--</option>
                            {% for t in t_list %}
                            <option value="{{ t.id }}">{{ t.t_name }}</option>
                            {% endfor %}
                        </select>
                      </div>

                      <div class="form-group">
                        <label class="">商品价格</label>
                        <input class="form-control" type="text" name="g_price">
                      </div>
                      <div class="form-group">
                        <label class="">商品保质期</label>
                        <input class="form-control" type="text" name="g_safe_date">
                      </div>
                      <div class="form-group">
                        <label class="">保质期单位</label>
                        <select class="form-control" name="save_unit">
                            <option value="年">年</option>
                            <option value="月">月</option>
                            <option value="日">日</option>
                            <option value="时">时</option>
                            <option value="周">周</option>
                        </select>
                      </div>
                      <div class="form-group">
                        <label class="">商品出场日期</label>
                        <input class="form-control" type="text" name="g_public_date">
                      </div>
                      <div class="form-group">
                        <label class="">商品数量</label>
                        <input class="form-control" type="text" name="goods_number">
                      </div>
                      <div class="form-group">
                        <label class="">商品描述</label>
                        <textarea class="form-control" name="g_description"></textarea>
                      </div>
                      <div class="form-group">
                        <label class="">商品介绍</label>
                        <textarea class="form-control" name="desc_content"></textarea>
                      </div>
                      <div class="form-group">
                        <label class="">商品图片</label>
                        <input class="form-control" type="file" name="g_picture">
                      </div>
                      <button class="btn btn-primary fa-pull-right" type="submit">提交商品</button>
                  </form>
              </div>
          </div>
      </div>
  </div>
{% endblock %}
